import Http, {ReqProps} from "@/common/http";


export type SysMenuTree = {
    key: string
    pId: string
    title: string
    stat: boolean
    tag: string
    type: string
    url: string
    path: string
    icon: string
    element: string
    inner: boolean
    children: SysMenuTree[]
}


class SysMenu {
    AddMenuRoot ="addMenuRoot"
    selectTree(props: ReqProps<SysMenuTree[]>) {
        Http.doGet("/api/menu/tree", props)
    }

    doEdit(props: ReqProps<void>) {
        Http.doPost("/api/menu/edit", props)
    }

    doResort(props: ReqProps<void>) {
        Http.doPost("/api/menu/resort", props)
    }

    doMove(props: ReqProps<void>) {
        Http.doPost("/api/menu/move", props)
    }

    deleteById(props: ReqProps<void>) {
        Http.doPost("/api/menu/delete", props)
    }

}

// eslint-disable-next-line import/no-anonymous-default-export
export default new SysMenu()